package com.example.demo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.entity.User;
import com.example.demo.mapper.UserMapper;
import com.example.demo.service.UserService;

@Service
public class UserServiceImpl implements UserService {

  @Autowired
  private UserMapper userMapper;

  public boolean add(User user) {
    return userMapper.add(user) > 0;
  }

  public boolean update(User user) {
    return userMapper.update(user) > 0;
  }

  public int delete(int id) {
    return userMapper.delete(id);
  }

  public User findByName(String name) {
    return userMapper.findByName(name);
  }

  public User[] find(String name) {
    return userMapper.find(name);
  }

  public User findOne(int id) {
    return userMapper.findOne(id);
  }
}
